home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr47 / lzpip103.zip / READ.ME < prev    next >
Text File  |  1994-03-30  |  8KB  |  186 lines

  1. This directory contains source codes for 'lzpipe' library, which
  2. implements two most popular compression methods: LZW and deflate.
  3. Both of these methods are de-facto lossless compression standards;
  4. LZW is used in well-known 'compress' utility and deflate is used
  5. by number of utilities starting from 'pkzip' by PKWare Inc. to,
  6. let's say, 'gzip' utility.
  7.  
  8. The library was intended to give a programming capability
  9. analogous to UNIX pipes for systems like MS-DOS, but it also
  10. allows access to compressed files as well. In comparison to all
  11. compression sources I've ever seen, this library allows to process
  12. compressed data in open()/read()/write()/close() style.
  13.  
  14. These source codes implement pure compression, I made no attempt
  15. to approach zip directory service.
  16.  
  17. Source codes for both LZW compression and decompression are
  18. derived from sources of 'compress' utility initially written by
  19. Joe Orost.
  20.  
  21. Source codes for deflate compression and inflate decompression are
  22. derived from Info-Zip zip/unzip utilities sources. 'Inflate'
  23. decompressor was initially written by Mark Adler and 'deflate'
  24. compressor was initially written by Jean-loup Gailly.
  25.  
  26. Keep in mind that unlike LZW, deflate implementation development
  27. is still continued and this library may be obsoleted by future
  28. versions of Info-Zip software and/or gzip utility.
  29.  
  30. Info-ZIP's software (Zip, UnZip and related utilities) is free and
  31. can be obtained as source code or executables from various
  32. anonymous-ftp sites, including ftp.uu.net:/pub/archiving/zip/*.
  33.  
  34. All the codes must work in same fashion under most existing
  35. operating systems; I tested them under MS-DOS and FreeBSD.
  36.  
  37. This software is distributed in the hope that it will be useful,
  38. but WITHOUT ANY WARRANTY; without even the implied warranty of
  39. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  40.  
  41.           Copyright issues
  42.  
  43. 1) All the decompression codes are in the public domain.
  44.  
  45. 2) LZW compression code is in the public domain as well, but keep
  46.    in mind that LZW compression method is protected by US patent.
  47.    This partially means you can not sell inside US a product using
  48.    LZW compression (until you have patent owner permittion).
  49.  
  50. 3) Since deflate compression code was borrowed from Info-Zip
  51.    distribution it is commited to Info-Zip license, which
  52.    in particular says:
  53. "Permission is granted to any individual or institution to use, copy, or
  54. redistribute this software so long as all of the original files are included,
  55. that it is not sold for profit, and that this copyright notice is retained."
  56.  
  57.      and
  58.  
  59. "Q.Can I use the source code of zip and unzip in my commercial application?
  60.  
  61. A. Yes, so long as you include in your product an acknowledgment and an
  62.    offer of the original compression sources for free or for a small
  63.    copying fee, and make clear that there are no extra or hidden charges
  64.    resulting from the use of the compression code by your product. In other
  65.    words, you are allowed to sell only your own work, not ours."
  66.  
  67.      See Info-Zip distribution for more details.
  68.  
  69.  
  70. Well, now let's speak about sources itself. Here is very short
  71. library description (all the definitions below are contained in
  72. 'lzpipe.h' header file):
  73.  
  74.         Zip file format arguments:
  75. #define ZIP_ANY 0
  76. #define ZIP_PKW 1
  77. #define ZIP_GNU 2
  78.  
  79.         Value to indicate unpredictable data size for LZW
  80. compression:
  81. #define LZW_ANYSIZE 0x7fffffffL
  82.  
  83.         Error code and corresponding messages list:
  84. extern int lzerror;
  85. extern char *lzerrlist[];
  86.  
  87.         Individual error codes:
  88. #define ZNOPEN 0
  89. #define ZNOMEM 1 /* Not enough memory */
  90. #define ZMAGIC 2 /* Bad magic header */
  91. #define ZUNSUP 3 /* Reserved field or compression method */
  92. #define ZHDEOF 4 /* EOF while processing header */
  93. #define ZMOULD 5 /* Invalid compressed data */
  94. #define ZNOEOF 6 /* More data to process at close */
  95. #define ZBADSZ 7 /* Real size differs from recorded */
  96. #define BADCRC 8 /* It is */
  97. #define ZWRITE 9 /* Error writing output file */
  98. #define ZERROR 10 /* Generic/internal error */
  99.  
  100.         If no other said, the functions below return 0 on success
  101. or -1 on error and place corresponding value into 'lzerror'
  102. variable:
  103.  
  104. int  unzalloc (void) - allocates a memory for inflate
  105.         decompression; as a rule you have not call this function.
  106.  
  107. int  unzopen  (LZ_INP_TYPE, int) - initialise inflation process
  108.         first argument may be file or function pointer depending
  109.         on compilation options.
  110.  
  111. int  unzread  (char *, unsigned) - read given number of
  112.         decompressed data into given buffer; returns number of
  113.         bytes read.
  114.  
  115. int  unzclose (void) - terminates inflate processing; return
  116.         value above zero indicates warning message.
  117.  
  118. void unzfree  (void) - as a rule you have not call this function.
  119.  
  120. int  zipalloc (void) - allocates a memory for deflate
  121.         compression; as a rule you have not call this function.
  122.  
  123. int  zipcreat (LZ_OUT_TYPE, int, int)  - initialise deflation
  124.         process; first argument may be file or function pointer
  125.         depending on compilation options, second and third
  126.         arguments stands for zip file format (see above) and
  127.         compression level (1-9).
  128.  
  129. int  zipwrite (char *, unsigned) - writes given number of bytes
  130.         from given buffer, returns number of bytes accepted.
  131.  
  132. void zipfree  (void) - as a rule you have not call this function.
  133.  
  134. long zipclose (void) - terminates deflation process; returns total
  135.         size of compressed file or -1 on error.
  136.  
  137. int  lzwalloc (int) - allocates memory for LZW compression with
  138.         bits factor not greater than given; returns maximum
  139.         possible bits factor.
  140.  
  141. int  lzwcreat (LZ_OUT_TYPE, long, int) - initialise compression
  142.         process; first argument may be file or function pointer
  143.         depending on compilation options, second and third
  144.         arguments stands for uncompressed data size and bits
  145.         factor value.
  146.  
  147. int  lzwwrite (char *, unsigned) - writes given number of bytes
  148.         from given buffer, returns number of bytes accepted.
  149.  
  150. void lzwfree  (void) - as a rule you have not call this function.
  151.  
  152. long lzwclose (void) - terminates deflation process; returns total
  153.         size of compressed file or -1 on error.
  154.  
  155. int  lzwmark  (int) - allocates memory for LZW decompression with
  156.         bits factor not greater than given; returns maximum
  157.         possible bits factor.
  158.  
  159. int  lzwopen  (LZ_INP_TYPE) - initialises decompression process;
  160.         the argument may be file or function pointer depending on
  161.         compilation options.
  162.  
  163. int  lzwread  (char *, unsigned) - reads given number of
  164.         decompressed data into given buffer; returns number of
  165.         bytes read.
  166.  
  167. void lzwrelease (void) - frees decompression buffers.
  168.  
  169. The source directory also includes 'makefile' for UNIX and
  170. 'makefile.tcc' for Turbo C 2.01 under MS-DOS to build demo
  171. programs: doz and dogzip. Both of them may be called as
  172.  
  173.         do<z-you-want> -c|d <input_file> <output_file>
  174.  
  175. where 'c' or 'd' options stand for compression and decompression
  176. respectively.
  177. Programs also have internal help, wich mention other options.
  178.  
  179. The compilation default is for pipe capability, use -DLZFILE
  180. compilation option to biuld file access version.
  181.  
  182. If you have questions concerning this library please E-mail to
  183.  
  184.         Tim V.Shaporev          tim@rd.relcom.msk.su aka
  185.                                 tim@shaporev.msk.su
  186.